package com.scott.service.combine.impl;

import com.scott.entity.bo.HeadLine;
import com.scott.entity.bo.ShopCategory;
import com.scott.entity.dto.MainPageInfoDTO;
import com.scott.entity.dto.Result;
import com.scott.service.combine.HeadLineShopCategoryCombineService;
import com.scott.service.solo.HeadLineService;
import com.scott.service.solo.ShopCategoryService;
import org.simpleframework.core.annotation.Service;
import org.simpleframework.inject.annotation.Autowired;

import java.util.List;

/**
 * @ClassName HeadLineShopCategoryCombineServiceImpl
 * @Description
 * @Author 47980
 * @Date 2020/6/9 6:07
 * @Version V_1.0
 **/
@Service
public class HeadLineShopCategoryCombineServiceImpl implements HeadLineShopCategoryCombineService {

    @Autowired
    private HeadLineService headLineService;

    @Autowired
    private ShopCategoryService shopCategoryService;

    @Override
    public Result<MainPageInfoDTO> getMainPageInfo() {
        // 1. 获取头条列表
        HeadLine headLine = HeadLine.builder()
                .enableStatus(1)
                .build();
        Result<List<HeadLine>> headLineResult = headLineService.queryHeadLine(headLine, 1, 4);
        // 2. 获取店铺信息列表
        ShopCategory shopCategory = ShopCategory.builder().build();
        Result<List<ShopCategory>> shopCategoryResult = shopCategoryService.queryShopCategory(shopCategory, 1, 10);
        // 3. 合并，并返回
        Result<MainPageInfoDTO> mainPageInfoResult = mergeMainPageInfoResult(headLineResult, shopCategoryResult);
        return mainPageInfoResult;
    }

    private Result<MainPageInfoDTO> mergeMainPageInfoResult(Result<List<HeadLine>> headLineResult, Result<List<ShopCategory>> shopCategoryResult) {
        return null;
    }
}
